<!--
 * @Autor: Ruohong Yu
 * @Date: 2021-11-27 16:40:05
 * @LastEditors: Haiting Zhao
 * @LastEditTime: 2021-12-19 13:11:07
 * @Description: 数据字典
 * @FilePath: \Management-of-Scientific-Research-in-Universities-Front\src\views\systemmanage\Dictionary.vue
-->

<template>
  <div>
    <!-- 面包屑导航区 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ name:'WorkPlace' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>系统管理</el-breadcrumb-item>
      <el-breadcrumb-item>数据字典</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <el-table
        :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)"
        border
        stripe
        style="width: 100%"
      >
        <el-table-column
          label="#"
          type="index"
          width="100px"
        />
        <el-table-column
          label="字典名称"
          prop="name"
          align="left"
        />
        <el-table-column
          label="字典说明"
          prop="intro"
        />
        <el-table-column
          label="操作"
          align="center"
          width="150px"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="primary"
              icon="el-icon-edit"
              @click="handleEdit(scope.row)"
            >编 辑</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <el-pagination
        style="text-align: right;"
        :current-page="currentPage"
        :page-sizes="[3, 5, 10, 20]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="totalNum"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-card>

    <el-dialog :title="title" :visible.sync="outerVisible">
      <el-button type="primary" @click="add">添 加</el-button>
      <el-table
        :data="detailsData"
        border
        style="width: 100%"
      >
        <el-table-column type="index" label="#" width="70" />
        <el-table-column :property="bcintername" label="名称" />
        <el-table-column
          label="操作"
          align="center"
          width="200"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="primary"
              icon="el-icon-edit"
              @click="handleEdit2(scope.row)"
            >编 辑</el-button>
            <el-button
              size="mini"
              type="danger"
              icon="el-icon-delete"
              @click="handleDelete2(scope.row)"
            >删 除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button @click="hide">确 认</el-button>
      </div>
    </el-dialog>

    <el-dialog title="添加字典项" :visible.sync="dialogFormVisible" width="30%">
      <el-form :model="form" size="small">
        <el-form-item label="字典名称" label-width="110">
          <el-input v-model="form.name" autocomplete="off" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="addcomfirm">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import axios from 'axios'
export default {
  name: 'Dictionary',
  data() {
    return {
      dialogFormVisible: false,
      outerVisible: false,
      innerVisible: false,
      form: {
        name: ''
      },
      tableData: [{
        order: '1',
        name: '成果类型',
        intro: 'good',
        inter: 'achievementType',
        interid: 'atId',
        intername: 'atName'
      }, {
        order: '2',
        name: '结题类型',
        intro: '/ct',
        inter: 'conclusionType',
        interid: 'ctId',
        intername: 'ctName'
      }, {
        order: '3',
        name: '单位类型',
        intro: 'good',
        inter: 'department',
        interid: 'departmentId',
        intername: 'departmentName'
      }, {
        order: '4',
        name: '项目级别类型',
        intro: 'good',
        inter: 'level',
        interid: 'levelId',
        intername: 'levelName'
      }, {
        order: '5',
        name: '项目性质类型',
        intro: 'good',
        inter: 'nature',
        interid: 'natureId',
        intername: 'natureName'
      }, {
        order: '6',
        name: '论文类型',
        intro: 'good',
        inter: 'paperType',
        interid: 'ptId',
        intername: 'ptName'
      }, {
        order: '7',
        name: '专利范围',
        intro: 'good',
        inter: 'patentRange',
        interid: 'prId',
        intername: 'prName'
      }, {
        order: '8',
        name: '专利状态',
        intro: 'good',
        inter: 'patentStatus',
        interid: 'psId',
        intername: 'psName'
      }, {
        order: '9',
        name: '期刊类型',
        intro: 'good',
        inter: 'periodical',
        interid: 'periodicalId',
        intername: 'periodicalName'
      }, {
        order: '10',
        name: '研究类型',
        intro: 'good',
        inter: 'researchType',
        interid: 'rtId',
        intername: 'rtName'
      }, {
        order: '11',
        name: '项目状态',
        intro: 'good',
        inter: 'status',
        interid: 'statusId',
        intername: 'statusName'
      }, {
        order: '12',
        name: '学科门类',
        intro: 'good',
        inter: 'subjectCategory',
        interid: 'scId',
        intername: 'scName'
      }, {
        order: '13',
        name: '一级学科',
        intro: 'good',
        inter: 'subject',
        interid: 'subjectId',
        intername: 'subjectName'
      }],
      currentPage: 1,
      pageSize: 10,
      totalNum: 13,
      detailsData: [],
      title: '',
      bcinter: '',
      bcinterid: '',
      bcintername: '',
      selectrow: ''
    }
  },
  methods: {
    add() {
      this.dialogFormVisible = true
    },

    /**
     * @description: 添加字典
     * @param {*}
     * @return {*}
     * @author: Ruohong Yu
     */
    addcomfirm() {
      if (this.bcinterid === 'atId') {
        axios.post('/dictionary/insert/' + this.bcinter, {
          data: {
            atName: this.form.name
          }
        })
          .then(res => {
            this.getEverdata(this.bcrow, this.bcinter)
            this.$store.commit('setat', JSON.stringify(this.detailsData))
            this.$message({
              type: 'success',
              message: '添加成功 '
            })
            this.dialogFormVisible = false
          })
          .catch(err => {
            console.error(err)
            this.$message({
              type: 'info',
              message: '添加失败'
            })
          })
      } else if (this.bcinterid === 'ctId') {
        axios.post('/dictionary/insert/' + this.bcinter, {
          data: {
            ctName: this.form.name
          }
        })
          .then(res => {
            this.getEverdata(this.bcrow, this.bcinter)
            this.$store.commit('setct', JSON.stringify(this.detailsData))
            this.$message({
              type: 'success',
              message: '添加成功 '
            })
            this.dialogFormVisible = false
          })
          .catch(err => {
            console.error(err)
            this.$message({
              type: 'info',
              message: '添加失败'
            })
          })
      } else if (this.bcinterid === 'departmentId') {
        axios.post('/dictionary/insert/' + this.bcinter, {
          data: {
            departmentName: this.form.name
          }
        })
          .then(res => {
            this.getEverdata(this.bcrow, this.bcinter)
            this.$store.commit('setdepartment', JSON.stringify(this.detailsData))
            this.$message({
              type: 'success',
              message: '添加成功 '
            })
            this.dialogFormVisible = false
          })
          .catch(err => {
            console.error(err)
            this.$message({
              type: 'info',
              message: '添加失败'
            })
          })
      } else if (this.bcinterid === 'levelId') {
        axios.post('/dictionary/insert/' + this.bcinter, {
          data: {
            levelName: this.form.name
          }
        })
          .then(res => {
            this.getEverdata(this.bcrow, this.bcinter)
            this.$store.commit('setlevel', JSON.stringify(this.detailsData))
            this.$message({
              type: 'success',
              message: '添加成功 '
            })
            this.dialogFormVisible = false
          })
          .catch(err => {
            console.error(err)
            this.$message({
              type: 'info',
              message: '添加失败'
            })
          })
      } else if (this.bcinterid === 'natureId') {
        axios.post('/dictionary/insert/' + this.bcinter, {
          data: {
            natureName: this.form.name
          }
        })
          .then(res => {
            this.getEverdata(this.bcrow, this.bcinter)
            this.$store.commit('setnature', JSON.stringify(this.detailsData))
            this.$message({
              type: 'success',
              message: '添加成功 '
            })
            this.dialogFormVisible = false
          })
          .catch(err => {
            console.error(err)
            this.$message({
              type: 'info',
              message: '添加失败'
            })
          })
      } else if (this.bcinterid === 'ptId') {
        axios.post('/dictionary/insert/' + this.bcinter, {
          data: {
            ptName: this.form.name
          }
        })
          .then(res => {
            this.getEverdata(this.bcrow, this.bcinter)
            this.$store.commit('setpt', JSON.stringify(this.detailsData))
            this.$message({
              type: 'success',
              message: '添加成功 '
            })
            this.dialogFormVisible = false
          })
          .catch(err => {
            console.error(err)
            this.$message({
              type: 'info',
              message: '添加失败'
            })
          })
      } else if (this.bcinterid === 'prId') {
        axios.post('/dictionary/insert/' + this.bcinter, {
          data: {
            prName: this.form.name
          }
        })
          .then(res => {
            this.getEverdata(this.bcrow, this.bcinter)
            this.$store.commit('setpr', JSON.stringify(this.detailsData))
            this.$message({
              type: 'success',
              message: '添加成功 '
            })
            this.dialogFormVisible = false
          })
          .catch(err => {
            console.error(err)
            this.$message({
              type: 'info',
              message: '添加失败'
            })
          })
      } else if (this.bcinterid === 'psId') {
        axios.post('/dictionary/insert/' + this.bcinter, {
          data: {
            psName: this.form.name
          }
        })
          .then(res => {
            this.getEverdata(this.bcrow, this.bcinter)
            this.$store.commit('setps', JSON.stringify(this.detailsData))
            this.$message({
              type: 'success',
              message: '添加成功 '
            })
            this.dialogFormVisible = false
          })
          .catch(err => {
            console.error(err)
            this.$message({
              type: 'info',
              message: '添加失败'
            })
          })
      } else if (this.bcinterid === 'periodicalId') {
        axios.post('/dictionary/insert/' + this.bcinter, {
          data: {
            periodicalName: this.form.name
          }
        })
          .then(res => {
            this.getEverdata(this.bcrow, this.bcinter)
            this.$store.commit('setperiodical', JSON.stringify(this.detailsData))
            this.$message({
              type: 'success',
              message: '添加成功 '
            })
            this.dialogFormVisible = false
          })
          .catch(err => {
            console.error(err)
            this.$message({
              type: 'info',
              message: '添加失败'
            })
          })
      } else if (this.bcinterid === 'rtId') {
        axios.post('/dictionary/insert/' + this.bcinter, {
          data: {
            rtName: this.form.name
          }
        })
          .then(res => {
            this.getEverdata(this.bcrow, this.bcinter)
            this.$store.commit('setrt', JSON.stringify(this.detailsData))
            this.$message({
              type: 'success',
              message: '添加成功 '
            })
            this.dialogFormVisible = false
          })
          .catch(err => {
            console.error(err)
            this.$message({
              type: 'info',
              message: '添加失败'
            })
          })
      } else if (this.bcinterid === 'scId') {
        axios.post('/dictionary/insert/' + this.bcinter, {
          data: {
            subjectName: this.form.name
          }
        })
          .then(res => {
            this.getEverdata(this.bcrow, this.bcinter)
            this.$store.commit('setsc', JSON.stringify(this.detailsData))
            this.$message({
              type: 'success',
              message: '添加成功 '
            })
            this.dialogFormVisible = false
          })
          .catch(err => {
            console.error(err)
            this.$message({
              type: 'info',
              message: '添加失败'
            })
          })
      }
    },

    /**
     * @description: 修改字典
     * @param {*} row
     * @return {*}
     * @author: Ruohong Yu
     */
    handleEdit2(row) {
      this.$prompt('请输入修改名称', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        inputPattern: /\S/,
        inputErrorMessage: '名称不为空'
      }).then(({ value }) => {
        if (this.bcinterid === 'atId') {
          axios.post('/dictionary/update/' + this.bcinter, {
            data: {
              atId: row.atId,
              atName: value
            }
          })
            .then(res => {
              // console.log(res)
              this.$message({
                type: 'success',
                message: '修改成功 '
              })
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setat', JSON.stringify(this.detailsData))
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '修改失败'
              })
            })
        } else if (this.bcinterid === 'ctId') {
          axios.post('/dictionary/update/' + this.bcinter, {
            data: {
              ctId: row.ctId,
              ctName: value
            }
          })
            .then(res => {
              // console.log(res)
              this.$message({
                type: 'success',
                message: '修改成功 '
              })
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setct', JSON.stringify(this.detailsData))
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '修改失败'
              })
            })
        } else if (this.bcinterid === 'departmentId') {
          axios.post('/dictionary/update/' + this.bcinter, {
            data: {
              departmentId: row.departmentId,
              departmentName: value
            }
          })
            .then(res => {
              // console.log(res)
              this.$message({
                type: 'success',
                message: '修改成功 '
              })
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setdepartment', JSON.stringify(this.detailsData))
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '修改失败'
              })
            })
        } else if (this.bcinterid === 'levelId') {
          axios.post('/dictionary/update/' + this.bcinter, {
            data: {
              levelId: row.levelId,
              levelName: value
            }
          })
            .then(res => {
              // console.log(res)
              this.$message({
                type: 'success',
                message: '修改成功 '
              })
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setlevel', JSON.stringify(this.detailsData))
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '修改失败'
              })
            })
        } else if (this.bcinterid === 'natureId') {
          axios.post('/dictionary/update/' + this.bcinter, {
            data: {
              natureId: row.natureId,
              natureName: value
            }
          })
            .then(res => {
              // console.log(res)
              this.$message({
                type: 'success',
                message: '修改成功 '
              })
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setnature', JSON.stringify(this.detailsData))
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '修改失败'
              })
            })
        } else if (this.bcinterid === 'ptId') {
          axios.post('/dictionary/update/' + this.bcinter, {
            data: {
              ptId: row.ptId,
              ptName: value
            }

          })
            .then(res => {
              // console.log(res)
              this.$message({
                type: 'success',
                message: '修改成功 '
              })
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setpt', JSON.stringify(this.detailsData))
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '修改失败'
              })
            })
        } else if (this.bcinterid === 'prId') {
          axios.post('/dictionary/update/' + this.bcinter, {
            data: {
              prId: row.prId,
              prName: value
            }

          })
            .then(res => {
              // console.log(res)
              this.$message({
                type: 'success',
                message: '修改成功 '
              })
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setpr', JSON.stringify(this.detailsData))
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '修改失败'
              })
            })
        } else if (this.bcinterid === 'psId') {
          axios.post('/dictionary/update/' + this.bcinter, {
            data: {
              psId: row.psId,
              psName: value
            }

          })
            .then(res => {
              // console.log(res)
              this.$message({
                type: 'success',
                message: '修改成功 '
              })
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setps', JSON.stringify(this.detailsData))
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '修改失败'
              })
            })
        } else if (this.bcinterid === 'periodicalId') {
          axios.post('/dictionary/update/' + this.bcinter, {
            data: {
              periodicalId: row.periodicalId,
              periodicalName: value
            }

          })
            .then(res => {
              // console.log(res)
              this.$message({
                type: 'success',
                message: '修改成功 '
              })
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setperiodcal', JSON.stringify(this.detailsData))
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '修改失败'
              })
            })
        } else if (this.bcinterid === 'rtId') {
          axios.post('/dictionary/update/' + this.bcinter, {
            data: {
              rtId: row.rtId,
              rtName: value
            }

          })
            .then(res => {
              // console.log(res)
              this.$message({
                type: 'success',
                message: '修改成功 '
              })
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setrt', JSON.stringify(this.detailsData))
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '修改失败'
              })
            })
        } else if (this.bcinterid === 'scId') {
          axios.post('/dictionary/update/' + this.bcinter, {
            data: {
              scId: row.scId,
              subjectName: value
            }

          })
            .then(res => {
              // console.log(res)
              this.$message({
                type: 'success',
                message: '修改成功 '
              })
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setsc', JSON.stringify(this.detailsData))
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '修改失败'
              })
            })
        }
        // else if (this.bcinterid === 'statusId') {                                  //bug here
        //   axios.post(this.bcinter + 'update', {
        //     statusId: row.statusId,
        //     statusName: value
        //   })
        //     .then(res => {
        //       console.log(res)
        //       this.$message({
        //         type: 'success',
        //         message: '修改成功 '
        //       })
        //       this.getEverdata(this.bcrow, this.bcinter)
        //     })
        //     .catch(() => {
        //       this.$message({
        //         type: 'info',
        //         message: '修改失败'
        //       })
        //     })
        // }
      }).catch((err) => {
        console.log(err)
        this.$message({
          type: 'info',
          message: '取消输入'
        })
        this.innerVisible = false
      })
    },

    /**
     * @description: 删除字典
     * @param {*} row
     * @return {*}
     * @author: Ruohong Yu
     */
    handleDelete2(row) {
      this.$confirm('此操作将永久删除该字典项, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        if (this.bcinterid === 'atId') {
          axios.get('/dictionary/delete/' + this.bcinter, {
            params: {
              primaryId: row.atId
            }
          })
            .then(res => {
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setat', JSON.stringify(this.detailsData))
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            })
            .catch(err => {
              console.error(err)
              this.$message({
                type: 'info',
                message: '删除失败'
              })
            })
        } else if (this.bcinterid === 'ctId') {
          axios.get('/dictionary/delete/' + this.bcinter, {
            params: {
              primaryId: row.ctId

            }
          })
            .then(res => {
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setct', JSON.stringify(this.detailsData))
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            })
            .catch(err => {
              console.error(err)
              this.$message({
                type: 'info',
                message: '删除失败'
              })
            })
        } else if (this.bcinterid === 'departmentId') {
          axios.get('/dictionary/delete/' + this.bcinter, {
            params: {
              primaryId: row.departmentId

            }
          })
            .then(res => {
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setdepartment', JSON.stringify(this.detailsData))
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            })
            .catch(err => {
              console.error(err)
              this.$message({
                type: 'info',
                message: '删除失败'
              })
            })
        } else if (this.bcinterid === 'levelId') {
          axios.get('/dictionary/delete/' + this.bcinter, {
            params: {
              primaryId: row.levelId

            }
          })
            .then(res => {
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setlevel', JSON.stringify(this.detailsData))
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            })
            .catch(err => {
              console.error(err)
              this.$message({
                type: 'info',
                message: '删除失败'
              })
            })
        } else if (this.bcinterid === 'natureId') {
          axios.get('/dictionary/delete/' + this.bcinter, {
            params: {
              primaryId: row.natureId

            }
          })
            .then(res => {
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setnature', JSON.stringify(this.detailsData))
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            })
            .catch(err => {
              console.error(err)
              this.$message({
                type: 'info',
                message: '删除失败'
              })
            })
        } else if (this.bcinterid === 'ptId') {
          axios.get('/dictionary/delete/' + this.bcinter, {
            params: {
              primaryId: row.ptId

            }
          })
            .then(res => {
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setpt', JSON.stringify(this.detailsData))
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            })
            .catch(err => {
              console.error(err)
              this.$message({
                type: 'info',
                message: '删除失败'
              })
            })
        } else if (this.bcinterid === 'prId') {
          axios.get('/dictionary/delete/' + this.bcinter, {
            params: {
              primaryId: row.prId

            }
          })
            .then(res => {
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setpr', JSON.stringify(this.detailsData))
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            })
            .catch(err => {
              console.error(err)
              this.$message({
                type: 'info',
                message: '删除失败'
              })
            })
        } else if (this.bcinterid === 'psId') {
          axios.get('/dictionary/delete/' + this.bcinter, {
            params: {
              primaryId: row.psId

            }
          })
            .then(res => {
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setps', JSON.stringify(this.detailsData))
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            })
            .catch(err => {
              console.error(err)
              this.$message({
                type: 'info',
                message: '删除失败'
              })
            })
        } else if (this.bcinterid === 'periodicalId') {
          axios.get('/dictionary/delete/' + this.bcinter, {
            params: {
              primaryId: row.periodicalId

            }
          })
            .then(res => {
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setperiodcal', JSON.stringify(this.detailsData))
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            })
            .catch(err => {
              console.error(err)
              this.$message({
                type: 'info',
                message: '删除失败'
              })
            })
        } else if (this.bcinterid === 'rtId') {
          axios.get('/dictionary/delete/' + this.bcinter, {
            params: {
              primaryId: row.rtId

            }
          })
            .then(res => {
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setrt', JSON.stringify(this.detailsData))
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            })
            .catch(err => {
              console.error(err)
              this.$message({
                type: 'info',
                message: '删除失败'
              })
            })
        } else if (this.bcinterid === 'scId') {
          axios.get('/dictionary/delete/' + this.bcinter, {
            params: {
              primaryId: row.scId

            }
          })
            .then(res => {
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setsc', JSON.stringify(this.detailsData))
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            })
            .catch(err => {
              console.error(err)
              this.$message({
                type: 'info',
                message: '删除失败'
              })
            })
        } else if (this.bcinterid === 'statusId') {
          axios.get('/dictionary/delete/' + this.bcinter, {
            params: {
              primaryId: row.statusId

            }
          })
            .then(res => {
              this.getEverdata(this.bcrow, this.bcinter)
              this.$store.commit('setstatus', JSON.stringify(this.detailsData))
              this.$message({
                type: 'success',
                message: '删除成功!'
              })
            })
            .catch(err => {
              console.error(err)
              this.$message({
                type: 'info',
                message: '删除失败'
              })
            })
        }
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    },

    /**
     * @description: 每页数量改变
     * @param {*} val
     * @return {*}
     * @author: Ruohong Yu
     */
    handleSizeChange(val) {
      this.pageSize = val
    },

    /**
     * @description: 页码改变
     * @param {*} val
     * @return {*}
     * @author: Ruohong Yu
     */
    handleCurrentChange(val) {
      this.currentPage = val
    },

    /**
     * @description: 编辑字典按钮
     * @param {*} row
     * @return {*}
     * @author: Ruohong Yu
     */
    handleEdit(row) {
      this.outerVisible = true
      this.bcrow = row
      this.bcinter = row.inter
      this.bcinterid = row.interid
      this.bcintername = row.intername
      this.getEverdata(this.bcrow, this.bcinter)
    },

    /**
     * @description: 编辑字典窗口
     * @param {*} row
     * @param {*} inter
     * @return {*}
     * @author: Ruohong Yu
     */
    getEverdata(row, inter) {
      axios.get('/dictionary/searchAll/' + inter)
        .then(res => {
          this.title = row.name + '----字典数据项'
          this.detailsData = res.data.data
        })
        .catch(err => {
          console.error(err)
        })
    },
    hide() {
      this.outerVisible = false
      this.bcrow = ''
      this.bcinter = ''
      this.bcinterid = ''
      this.bcintername = ''
    }
  }
}
</script>
<style lang="less">
  .el-table-column{
    text-align: center;
    overflow: hidden;
  }
</style>
